"""
主窗口
"""
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
import qtawesome
from Z_haitao.view.top20w_widget import Top20W
from Z_haitao.view import wordsSource_widget


class MainUI(QtWidgets.QMainWindow):

    def __init__(self):
        super().__init__()
        self.init_ui()

    # 确定基本的框架布局
    def init_ui(self):
        self.setFixedSize(1300, 775)  # 设置主窗口固定大小

        # 设置主部件及布局
        self.main_widget = QtWidgets.QWidget()  # 设置窗口主部件
        self.main_layout = QtWidgets.QGridLayout()  # 创建主部件网格布局
        self.main_widget.setLayout(self.main_layout)  # 设置主部件布局为网格布局

        # 设置QMainWindow的中心组件
        self.setCentralWidget(self.main_widget)  # 设置为窗口主部件

        self.leftLayout_ui()
        self.rightLayout_ui()

    # 词源-框架左布局
    def leftLayout_ui(self):
        self.main_layout.addWidget(wordsSource_widget.wordsSource_widget(), 0, 0, 1, 2)

    # 词源-框架右布局
    def rightLayout_ui(self):
        top20w = Top20W()
        # select_widget = top20w.top20w_widget()
        self.main_layout.addWidget(top20w, 0, 2, 1, 10)


def main():
    app = QtWidgets.QApplication(sys.argv)
    gui = MainUI()
    gui.show()
    sys.exit(app.exec_())


if __name__ == '__main__':
    main()
